package domain_template

const (
	CodeSuccess = "0000"
	CodeFailed  = "0001"
)

type Result struct {
	Code string      `json:"code"`
	Msg  string      `json:"msg"`
	Data interface{} `json:"data"`
}

func Success() *Result {
	return &Result{Code: CodeSuccess, Msg: "SUCCESS"}
}

func SuccessData(data interface{}) *Result {
	return &Result{Code: CodeSuccess, Msg: "SUCCESS", Data: &data}
}

func Fail() *Result {
	return &Result{Code: CodeFailed, Msg: "FAILED"}
}

func FailMsg(msg string) *Result {
	return &Result{Code: CodeFailed, Msg: msg}
}